﻿using System;

namespace diantou.web.contest
{
    /// <summary>
    /// 提交排行榜(此页面不用)
    /// </summary>
    [fastCSharp.code.cSharp.webView(IsPool = true, IsReferer = false)]
    partial class acceptedRank : rank<acceptedRank>
    {
        ///// <summary>
        ///// 提交排行榜客户端缓存
        ///// </summary>
        //private static readonly fastCSharp.sql.logCache<int, diantou.dataAccess.contestJudge[]>.array cache = new fastCSharp.sql.logCache<int, dataAccess.contestJudge[]>.array(diantou.dataAccess.tcpCall.contestJudge.onProblemAcceptedRankLog, 8);
        /// <summary>
        /// 
        /// </summary>
        /// <param name="problemId"></param>
        /// <param name="language"></param>
        /// <param name="page"></param>
        /// <returns></returns>
        private bool loadView(int problemId, diantou.dataModel.judgeState.languageType language, int page)
        {
            if (base.loadView(problemId))
            {
                //fastCSharp.sql.logCache<int, diantou.dataAccess.contestJudge[]>.array.value cacheValue = language == dataModel.judgeState.languageType.All && page <= 1 ? cache.Get(problemId) : default(fastCSharp.sql.logCache<int, diantou.dataAccess.contestJudge[]>.array.value);
                //if (cacheValue.Value == null)
                //{
                //    cacheValue.Value = diantou.dataAccess.tcpCall.contestJudge.getAceptedRank(problemId, language, pageInfo.Size = fastCSharp.config.pub.Default.PageSize, pageInfo.Page = page, out pageInfo.Count);
                //    cache.Set(ref cacheValue);
                //}
                //else pageInfo=?;
                //load(cacheValue.Value);
                load(diantou.dataAccess.tcpCall.contestJudge.getAceptedRank(problemId, language, pageInfo.Size = fastCSharp.config.pub.Default.PageSize, pageInfo.Page = page, out pageInfo.Count));
                if (requestHeader.IsSearchEngine) pageInfo.Path = problem.Path.ContestAcceptedUserSubmit.ToPageString();
                return true;
            }
            return false;
        }
        /// <summary>
        /// 获取当前用户排行提交
        /// </summary>
        /// <param name="index"></param>
        /// <returns></returns>
        protected override diantou.dataAccess.contestJudge getRank(out int index)
        {
            return diantou.dataAccess.tcpCall.contestJudge.getAceptedRank(currentUser.Id, query.problemId, query.language, out index);
        }
    }
}
